package com.example.hybridmobiledemo.module.main.model.travel;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.OrientationHelper;
import androidx.recyclerview.widget.RecyclerView;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.Window;

import com.example.hybridmobiledemo.R;
import com.example.hybridmobiledemo.module.main.model.travel.bean.Tourism;
import com.example.hybridmobiledemo.util.GlideImageLoader;
import com.example.hybridmobiledemo.view.SmartTourismAdapter;
import com.youth.banner.Banner;

import java.util.ArrayList;
import java.util.List;

public class SmartTourism extends AppCompatActivity {
    private Banner banner;
    private RecyclerView smartTourismRV;
    private List<Tourism> list = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_smart_tourism);
        initView();
        initData();

        List images = new ArrayList();
        images.add("http://img.jj20.com/up/allimg/1114/0512210S939/2105120S939-12-1200.jpg");
        images.add("http://img.jj20.com/up/allimg/1114/0512210S939/2105120S939-12-1200.jpg");
        images.add("http://img.jj20.com/up/allimg/1114/0512210S939/2105120S939-12-1200.jpg");
        images.add("http://img.jj20.com/up/allimg/1114/0512210S939/2105120S939-12-1200.jpg");
        images.add("http://img.jj20.com/up/allimg/1114/0512210S939/2105120S939-12-1200.jpg");

        Banner banner = (Banner) findViewById(R.id.banner);
        //设置图片加载器
        banner.setImageLoader(new GlideImageLoader());
        //设置图片集合
        banner.setImages(images);

        //banner设置方法全部调用完毕时最后调用
        banner.start();

    }

    private void initData() {
        for (int i = 0; i < 8; i++) {
            String a = String.valueOf(i);

            list.add(new Tourism(a, a, a, a));


        }
    }

    @SuppressLint("WrongConstant")
    private void initView() {
        banner = (Banner) findViewById(R.id.banner);
        smartTourismRV = (RecyclerView) findViewById(R.id.smart_tourism_RV);
        smartTourismRV.setAdapter(new SmartTourismAdapter(this,list));
        smartTourismRV.setLayoutManager(new LinearLayoutManager(this, OrientationHelper.VERTICAL,false));
    }
}